Imports Microsoft.VisualBasic

Namespace VNDPOS.Entity
    Public MustInherit Class BaseEntity
        Private _ModifiedDate As Date
        Public Property ModifiedDate() As Date
            Get
                Return _ModifiedDate
            End Get
            Set(ByVal value As Date)
                _ModifiedDate = value
            End Set
        End Property
        Private _ModifiedID As String
        Public Property ModifiedID() As String
            Get
                Return _ModifiedID
            End Get
            Set(ByVal value As String)
                _ModifiedID = value
            End Set
        End Property
        Private _Synchronized As Boolean
        Public Property Synchronized() As Boolean
            Get
                Return _Synchronized
            End Get
            Set(ByVal value As Boolean)
                _Synchronized = value
            End Set
        End Property
        Private _Deleted As Boolean
        Public Property Deleted() As Boolean
            Get
                Return _Deleted
            End Get
            Set(ByVal value As Boolean)
                _Deleted = value
            End Set
        End Property
        Public Overrides Function ToString() As String
            Dim buf As String = ", " & Me.ModifiedID & ", " & Me.ModifiedDate.ToShortDateString() & ", " & Me.Synchronized.ToString() & ", " & Me.Deleted.ToString()

            Return buf
        End Function
        Public Overridable Function compareAndGetDiff(ByVal _NewObj As BaseEntity) As String
            Dim buf As String = ""
            If Me.Synchronized <> _NewObj.Synchronized Then
                buf &= ", synchronized=" & Me.Synchronized.ToString() & " -> " & _NewObj.Synchronized.ToString() & " "
            End If
            If Me.Deleted <> _NewObj.Deleted Then
                buf &= ", deleted=" & Me.Deleted.ToString() & " -> " & _NewObj.Deleted.ToString() & " "
            End If
            Return buf
        End Function
    End Class
End Namespace
